# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2014 Denis Gomes et al.
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions 
# are met:
#
#  * Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#  * Redistributions in binary form must reproduce the above copyright 
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#  * Neither the name of pyglet nor the names of its
#    contributors may be used to endorse or promote products
#    derived from this software without specific prior written
#    permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------------

'''Display positioned, scaled and rotated 3d primitives.

A primitive is an similar to a pyglet.sprite.Sprite.  Multiple primitives can
be display at different positions on the screen.  Primitives can also be scaled 
larger or smaller, rotated at any angle about an anchor point and drawn at a 
fractional opacity.

The following complete example imports a primitive object and creates an
instance of the primitive.  The primitive is then drawn in the window's 
draw event handler::

    import pyglet
    from pyglet.scene3d.primitives import Torus

    torus = Torus(2, 10, 21, 21)
    
    window = pyglet.window.Window()

    @window.event
    def on_draw():
        torus.draw()

    pyglet.app.run()

The primitive can be moved by modifying the ``x``, ``y``, and ``z`` properties.  
Other properties determine the primitive's rotation, scale and opacity.

The primitive's positioning, rotation and scaling all honor the original
primitive's anchor (anchor_x, anchor_y, anchor_z).


Drawing multiple primitives
===========================

Primitives can be "batched" together and drawn at once more quickly than if each
of their ``draw`` methods were called individually.  The following example
creates one hundred box primitives and adds each of them to a `Batch`.  The
entire batch of primitives is then drawn in one call::

    import pyglet
    from pyglet.scene3d import Box

    batch = pyglet.graphics.Batch()

    boxes = []
    for i in range(100):
        x, y, z = i * 10, 50, 0
        boxes.append(Box(x, y, z, position=(x, y, z), batch=batch)

    @window.event
    def on_draw():
        batch.draw()

Primitives can be freely modified in any way even after being added to a batch,
however a sprite can belong to at most one batch.  See the documentation for
`pyglet.graphics` for more details on batched rendering, and grouping of
primitives within batches.

:since: pyglet 1.2
'''

import math
import sys

from pyglet.gl import *
from pyglet import clock
from pyglet import event
from pyglet import graphics
from pyglet import image

class Primitive(event.EventDispatcher):
    pass
